<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_ecommerce'.DS.'tables');	

class EcommerceModelPromotion extends JModel
{
	function __construct()
	{
		parent::__construct();
	}
	function getList()
	{
		global $mainframe;
					
		$where=' ';
				
		$query = "SELECT p.*, com.name AS com_name FROM #__pr_product p 
			LEFT JOIN #__pr_product_category pc on p.id = pc.product_id 
			LEFT JOIN #__pr_category c on pc.category_id = c.id 
			LEFT JOIN #__pr_company com on com.id = p.manufacturer 
			WHERE p.published = 1 AND p.promotion = 1" ;
		$this->_db->setQuery($query);	
		$this->_product = $this->_db->loadObjectList();
		
		return $this->_product;
	}	
}
?>